using Microsoft.AspNetCore.Mvc;
using Product.Service;
using System.Threading.Tasks;

namespace hao_Product.Api.Controllers
{
    [ApiController]
    [Route("api/category")]
    public class CategoryController : ControllerBase
    {
        private readonly ICategoryService _categoryService;

        public CategoryController(ICategoryService categoryService)
        {
            _categoryService = categoryService;
        }

        [HttpGet("list")]
        public async Task<IActionResult> GetCategoryList()
        {
            var data = await _categoryService.GetCategoryTreeAsync();
            return Ok(data);
        }
    }
} 